home *** CD-ROM | disk | FTP | other *** search
File List | 1990-05-17 | 30.0 KB | 346 lines |
- Turbo Assembler Version 1.0 05-17-90 18:51:35 Page 1
- FDREAD.ASM
- fdread - lesen von disketten aller formate
-
- 1
- 2 0000 cseg segment word public 'device_dvr'
- 3 assume cs:cseg
- 4
- 5 org 0
- 6 0000 FFFFFFFF dd -1 ;Nur ein Driver
- 7 0004 8000 dw 1000000000000000b ;Character-Device
- 8 0006 0073r stra dw strategy ;Strategy-Routine
- 9 0008 007Er entr dw entry ;Einsprungadresse
- 10 000A 26 46 44 52 45 41 44 + db '&FDREAD ' ;Dummy-Name
- 11 20
- 12
- 13 0012 error proc far
- 14 0012 26: C7 47 03 8103 mov word ptr es:[bx+3],8103h ;Fehler, da nur Dummy-Device
- 15 0018 CB retf ;Ende
- 16 0019 error endp
- 17
- 18 old13 label dword ;Speicherung des alten Interrupt 13
- 19 0019 ???? old13_ofs dw ? ;Offset-Teil
- 20 001B ???? old13_seg dw ? ;Segment-Teil
- 21 001D 01 active db 1 ;bit 0 ON = active. (CJ)
- 22
- 23 001E en proc far
- 24 001E 3D 6368 cmp ax,6368h ;Special call ("ch")? (CJ)
- 25 0021 74 35 jz spcl ;Maybe. (CJ)
- 26 0023 2E: F6 06 001Dr 01 tstact: test byte ptr cs:active,01h ;Are we active? (CJ)
- 27 0029 74 28 jz exit ;Jump if not. (CJ)
- 28 002B F6 C2 80 test dl,80h ;Floppy disk? (CJ)
- 29 002E 75 23 jnz exit ;Jump if not. (CJ)
- 30 0030 0A E4 or ah,ah ;Wurde Funktion 0 RESET aufgerufen?
- 31 0032 74 1F jz exit ;Ja, dann Ende
- 32 0034 80 FC 04 cmp ah,4 ;Wurde Funktion über 4 aufgerufen?
- 33 0037 77 1A ja exit ;Ja, dann Ende
- 34 0039 50 push ax ;Alle benötigten...
- 35 003A 1E push ds ;...Register...
- 36 003B 53 push bx ;...retten
- 37 003C 33 DB xor bx,bx
- 38 003E 8E DB mov ds,bx ;Setze auch DS=0
- 39 0040 C5 1E 0078 lds bx,ds:[78h] ;Disk-Parameter Tabelle in DS:BX
- 40 0044 02 C1 add al,cl ;Start sector + # sectors (CJ)
- 41 0046 FE C8 dec al ;-1 = highest sector needed.(CJ)
- 42 0048 3A 47 04 cmp al,ds:[bx+4] ;Enough sectors in table? (CJ)
- 43 004B 76 03 jna nochng ;Jump if yes. (CJ)
- 44 004D 88 47 04 mov ds:[bx+4],al ;Setze auf maximal 25 Sektoren/Spur
- 45 0050 5B nochng: pop bx ;Alle...
- 46 0051 1F pop ds ;...Register...
- 47 0052 58 pop ax ;...zurückholen.
- 48 0053 2E: FF 2E 0019r exit: jmp old13 ;Springe an den alten Interrupt 13
- 49 ;
- 50 ; This routine, and other small changes have been made in this version by Crazy Jack
- 51 ; in May, 1990. The changes are in the public domain. Some rearranging of the code
- 52 ; in other areas was made to reduce the code size. This routine now responds ONLY to
- 53 ; floppy disk I/O requests, and it adjusts the number of sectors in the FD table so
- 54 ; that it never exceeds what the user is expecting. Using a fixed high value causes
- Turbo Assembler Version 1.0 05-17-90 18:51:35 Page 2
- FDREAD.ASM
- fdread - lesen von disketten aller formate
-
- 55 ; some programs (PCSHELL, for example) to be unable to format a disk while copying.
- 56 ;
- 57 ; Also added is a user interface. Into the AX register place the letters "ch" (the
- 58 ; "c" goes in the ah, the "h" goes in the al), and place the characters "cj" into the
- 59 ; DX register. Into the CL register place the new value that you want to store into the
- 60 ; flag byte called "active". Then do an interrupt 13h (the BIOS disk services call).
- 61 ; If FDREAD is not installed, this will result in an "invalid command" reply. If we
- 62 ; ARE installed, you will get a clear carry flag, a zero in the AH register, and the
- 63 ; PREVIOUS contents of the flag in the AL. You will also get the segment address of
- 64 ; this program in the ES, and the offset to the "active" flag byte in the BX register.
- 65 ;
- 66 0058 81 FA 636A spcl: cmp dx,636Ah ;Rest of special signature ("cj")?
- 67 005C 75 F5 jnz exit ;Jump if not. (CJ)
- 68 005E 0E push cs ;Return our segment address. (CJ)
- 69 005F 07 pop es ; (CJ)
- 70 0060 BB 001Dr ofsact: mov bx,offset active ;Return address of flag. (CJ)
- 71 0063 26: 8A 07 mov al,es:[bx] ;Return current flag. (CJ)
- 72 0066 26: 88 0F mov es:[bx],cl ;Set new flag value. (CJ)
- 73 0069 32 E4 xor ah,ah ;Clear AH and CF. (CJ)
- 74 006B FB sti ;...sure enuf! (CJ)
- 75 006C CA 0002 ret 2 ;Done. (CJ)
- 76 006F en endp
- 77 savreq label dword ;DWORD zur...
- 78 006F ???? savreq_o dw ? ;...Sicherung des...
- 79 0071 ???? savreq_s dw ? ;...Request Headers
- 80
- 81 0073 strategy proc far ;Strategy-Routine
- 82 0073 2E: 89 1E 006Fr mov cs:[savreq_o],bx ;BX speichern
- 83 0078 2E: 8C 06 0071r mov cs:[savreq_s],es ;ES speichern
- 84 007D CB ret ;...Fertig
- 85 007E strategy endp
- 86
- 87 007E entry proc far ;Einsprung Routine des Drivers
- 88 assume cs:cseg
- 89 007E 50 push ax ;Alle Register und Flags retten
- 90 007F 51 push cx
- 91 0080 52 push dx
- 92 0081 57 push di
- 93 0082 56 push si
- 94 0083 1E push ds
- 95 0084 06 push es
- 96 0085 53 push bx
- 97 0086 9C pushf
- 98 0087 2E: C4 1E 006Fr les bx,cs:[savreq] ;Hole den Request-Header
- 99 008C 26: 8A 47 02 mov al,es:[bx+2] ;Lade die Funktion
- 100 0090 3C 00 cmp al,0 ;größer als 0
- 101 0092 75 07 jnz unkwn_com ;Ja, Fehler
- 102 0094 EB 16 jmp short init ;Sonst initialisiere den Treiber
- 103 0096 entry endp
- 104
- 105 0096 rout proc far
- 106 0096 B8 0100 exit1: mov ax,100h ;Return ohne Fehler
- 107 0099 EB 03 jmp short exgem
- 108 009B B8 8103 unkwn_com: mov ax,8103h ;Unbekannter Befehl
- Turbo Assembler Version 1.0 05-17-90 18:51:35 Page 3
- FDREAD.ASM
- fdread - lesen von disketten aller formate
-
- 109 009E 26: 89 47 03 exgem: mov es:[bx+3],ax
- 110 00A2 9D popf ;Alle Register wiederherstellen
- 111 00A3 5B pop bx
- 112 00A4 07 pop es
- 113 00A5 1F pop ds
- 114 00A6 5E pop si
- 115 00A7 5F pop di
- 116 00A8 5A pop dx
- 117 00A9 59 pop cx
- 118 00AA 58 pop ax
- 119 00AB CB ret
- 120 00AC rout endp ;und zurückgehen
- 121
- 122
- 123 ;Die folgende Routine installiert FDR_OS2 als Device-Driver bei Einbindung
- 124 ;in CONFIG.SYS mit dem DEVICE= Befehl
- 125 ;HINWEIS: Auch unter DOS 4.xx oder OS/2 bitte mit DEVICE= installieren
- 126
- 127 00AC BA 00EAr init: mov dx,offset text ;Lade Begrüßungstext
- 128 00AF B4 09 mov ah,9 ;AH=9 für...
- 129 00B1 CD 21 int 21h ;...Ausgabe auf Bildschirm
- 130 00B3 26: C7 47 0E 006Fr mov word ptr es:[bx+14],offset savreq ;Bis hier resident machen
- 131 00B9 26: 8C 4F 10 mov es:[bx+16],cs ;Segment auch abspeichern
- 132 00BD 33 C0 xor ax,ax ;AX auf Null setzen
- 133 00BF 50 push ax ;Brauchen wir gleich nochmal
- 134 00C0 8E D8 mov ds,ax ;und DS=0 für Interrupt-Tabelle
- 135 00C2 C5 06 004C lds ax,ds:[13h*4] ;Lade alten Interrupt 13 in DS:BX
- 136 00C6 2E: A3 0019r mov cs:[old13_ofs],ax ;und speichere...
- 137 00CA 2E: 8C 1E 001Br mov cs:[old13_seg],ds ;...es ab.
- 138 00CF 1F pop ds ;Nochmal DS=0
- 139 00D0 C7 06 004C 001Er mov word ptr ds:[13h*4],offset en ;Setze Offset von neuem INT 13
- 140 00D6 8C 0E 004E mov ds:[13h*4+2],cs ;Setze Segment von neuem INT 13
- 141 00DA 2E: C7 06 0006r 0012r mov word ptr cs:[stra],offset error ;Alle Device-Driver-Requests...
- 142 00E1 2E: C7 06 0008r 0012r mov word ptr cs:[entr],offset error ;...mit UNKNOWN COMMAND beantowrten.
- 143 00E8 EB AC jmp exit1 ;und schon fertig.
- 144
- 145 00EA 46 44 52 45 41 44 20 + text db 'FDREAD - Ver 1.20cj - Written by: C.Hochstätter',10,10,13,"$"
- 146 2D 20 56 65 72 20 31 +
- 147 2E 32 30 63 6A 20 2D +
- 148 20 57 72 69 74 74 65 +
- 149 6E 20 62 79 3A 20 43 +
- 150 2E 48 6F 63 68 73 74 +
- 151 84 74 74 65 72 0A 0A +
- 152 0D 24
- 153 011D 0A 07 46 44 52 45 41 + nimsg db 10,7,'FDREAD is not installed.',10,13,'$'
- 154 44 20 69 73 20 6E 6F +
- 155 74 20 69 6E 73 74 61 +
- 156 6C 6C 65 64 2E 0A 0D +
- 157 24
- 158 013A 46 44 52 45 41 44 20 + fdonmsg db 'FDREAD is on',10,13,'$'
- 159 69 73 20 6F 6E 0A 0D +
- 160 24
- 161 0149 46 44 52 45 41 44 20 + fdoffmsg db 'FDREAD is off',10,13,'$'
- 162 69 73 20 6F 66 66 0A +
- Turbo Assembler Version 1.0 05-17-90 18:51:35 Page 4
- FDREAD.ASM
- fdread - lesen von disketten aller formate
-
- 163 0D 24
- 164
- 165 ;Die folgende Routine installiert FDR_OS2 bei Aufruf von der DOS-Kommandozeile.
- 166 ;HINWEIS: Diese Installation ist nicht möglich unter OS/2
- 167
- 168 0159 33 C0 exeinst: xor ax,ax ;AX=0
- 169 015B 2E: A3 0056r mov word ptr cs:[exit+3],ax ;Ok, nicht besonders elegant
- 170 ;(Don't EVER apologize for (CJ)
- 171 ;things like that!!) (CJ)
- 172 015F 2E: C7 06 0061r 0004 mov word ptr cs:[ofsact+1],offset active-offset old13 ;See? (CJ)
- 173 0166 2E: C7 06 0026r 0004 mov word ptr cs:[tstact+3],offset active-offset old13 ; (CJ)
- 174 016D B4 51 mov ah,51h ;Hole den PSP...
- 175 016F CD 21 int 21h ;...in BX
- 176 0171 53 push bx ;Speichern...
- 177 ; push bx THIS JUST CREATES A ;2 x
- 178 ; pop ds SMALL, GENERALLY USELESS;...in DS
- 179 ; mov es,ds:[2ch] HOLE IN RAM. LET'S ;Environment in ES holen
- 180 ; mov ah,49h DROP IT FOR NOW. ;AH=49, um Environment
- 181 ; int 21h ;freizugeben
- 182 0172 07 pop es ;PSP wieder in ES
- 183 0173 0E push cs ;DS mit Programm
- 184 0174 1F pop ds ;Segment laden
- 185 ;
- 186 ; We're gonna break in right here and see if there's a command line and see if
- 187 ; we need to be installed.
- 188 ;
- 189 0175 32 ED xor ch,ch ;First we scan the com- (CJ)
- 190 0177 26: 8A 0E 0080 mov cl,es:[128] ;mand tail. (CJ)
- 191 017C BF 0081 mov di,129 ;Aim at start. (CJ)
- 192 017F B0 20 mov al,' ' ;Scan over any spaces. (CJ)
- 193 0181 FC cld ; (CJ)
- 194 0182 F3> AE repe scasb ; (CJ)
- 195 0184 4F dec di ;Back up to character found(CJ)
- 196 0185 26: 8B 05 mov ax,es:[di] ;Pick up two of them. (CJ)
- 197 0188 0D 2020 or ax,2020h ;Force lower case. (CJ)
- 198 018B 3C 6F cmp al,'o' ;Is the first one "o"? (CJ)
- 199 018D 75 02 jne noO ;Jump if not, (CJ)
- 200 018F 8A C4 mov al,ah ;else get 2nd char. (CJ)
- 201 0191 06 noO: push es ;Save results and stuff. (CJ)
- 202 0192 50 push ax ; (CJ)
- 203 0193 B8 6368 mov ax,6368h ;Now see if we're (CJ)
- 204 0196 BA 636A mov dx,636Ah ;already installed (CJ)
- 205 0199 B1 01 mov cl,1 ;(try to change status). (CJ)
- 206 019B CD 13 int 13h ; (CJ)
- 207 019D 73 12 jnc alrdyin ;Jump if already installed.(CJ)
- 208 019F 58 pop ax ;Get restored. (CJ)
- 209 01A0 07 pop es ; (CJ)
- 210 01A1 3C 20 cmp al,' ' ;Install? (CJ)
- 211 01A3 74 3D je inwego ;Jump if yes.... (CJ)
- 212 01A5 BA 011Dr mov dx,offset nimsg ;Send error message. (CJ)
- 213 01A8 B4 09 mov ah,9 ; (CJ)
- 214 01AA CD 21 int 21h ; (CJ)
- 215 01AC B8 4C69 mov ax,4C69h ;Exit with not-zero (CJ)
- 216 01AF CD 21 int 21h ;error level code. (CJ)
- Turbo Assembler Version 1.0 05-17-90 18:51:35 Page 5
- FDREAD.ASM
- fdread - lesen von disketten aller formate
-
- 217
- 218 01B1 8A C8 alrdyin: mov cl,al ;Keep original setting. (CJ)
- 219 01B3 58 pop ax ;Get back command. (CJ)
- 220 01B4 3C 6E cmp al,'n' ;Is command "on"? (CJ)
- 221 01B6 75 04 jne tryf ;Jump if not, (CJ)
- 222 01B8 B1 01 mov cl,1 ;else set if to ON. (CJ)
- 223 01BA EB 18 jmp short fdset ; (CJ)
- 224 01BC 3C 66 tryf: cmp al,'f' ;Okay, is it "off"? (CJ)
- 225 01BE 75 04 jne showhat ;Jump if just display. (CJ)
- 226 01C0 32 C9 xor cl,cl ;Set it to OFF. (CJ)
- 227 01C2 EB 10 jmp short fdset ;Go set new value. (CJ)
- 228
- 229 01C4 51 showhat: push cx ;Save switch value. (CJ)
- 230 01C5 BA 013Ar mov dx,offset fdonmsg ;Select 'off' or (CJ)
- 231 01C8 0A C9 or cl,cl ;"on" message as the (CJ)
- 232 01CA 75 03 jnz pumpitout ;situation requires. (CJ)
- 233 01CC BA 0149r mov dx,offset fdoffmsg ; (CJ)
- 234 01CF B4 09 pumpitout: mov ah,9 ; (CJ)
- 235 01D1 CD 21 int 21h ;Display the result. (CJ)
- 236 01D3 59 pop cx ;Get back switch value. (CJ)
- 237 01D4 B8 6368 fdset: mov ax,6368h ;Send it off to (CJ)
- 238 01D7 BA 636A mov dx,636Ah ;already installed (CJ)
- 239 01DA CD 13 int 13h ;copy of FDREAD. (CJ)
- 240 01DC 8A C1 mov al,cl ;Return code = flag. (CJ)
- 241 01DE B4 4C mov ah,4Ch ;Then do a benign (CJ)
- 242 01E0 CD 21 int 21h ;end of job. (CJ)
- 243 ;
- 244 ; --and now back to the installation code:
- 245 ;
- 246 01E2 BA 00EAr inwego: mov dx,offset text ;Begrüßungstext laden
- 247 01E5 B4 09 mov ah,9 ;Und über INT 21...
- 248 01E7 CD 21 int 21h ;...auf Bildschirm ausgeben
- 249 01E9 BF 0060 mov di,60h ;Hier können wir die Routine laden
- 250 01EC BE 0019r mov si,offset old13 ;Und zwar ab hier
- 251 01EF B9 002B mov cx,(offset savreq-offset old13+1)/2 ;mit dieser Länge
- 252 01F2 FC cld
- 253 01F3 F3> A5 rep movsw ;Ok, verschiebe den Code
- 254 01F5 8C C0 mov ax,es ;Nun DS auf neues...
- 255 01F7 05 0006 add ax,6 ;...Segment...
- 256 01FA 8E D8 mov ds,ax ;...setzen.
- 257 01FC B8 3513 mov ax,3513h ;Lade die alte INT 13 Routine
- 258 01FF CD 21 int 21h ;über DOS Call
- 259 0201 89 1E 0000 mov ds:[0],bx ;Speichere die Werte ab
- 260 0205 8C 06 0002 mov ds:[2],es ;Segment und Offset
- 261 0209 BA 0005 mov dx,offset en-offset old13 ;Beginn der Service-Routine
- 262 020C B8 2513 mov ax,2513h ;Über DOS-Call
- 263 020F CD 21 int 21h ;installieren
- 264 0211 B8 3103 mov ax,3103h ;Wir bleiben speicherresident
- 265 0214 BA 000C mov dx,(offset savreq-offset old13+15)/16+6;Anzahl der benötigten
- 266 0217 CD 21 int 21h ;Paragraphen Und Ende
- 267
- 268 0219 cseg ends
- 269 end exeinst
- Turbo Assembler Version 1.0 05-17-90 18:51:35 Page 6
- Symbol Table
-
-
- Symbol Name Type Value Cref defined at #
-
- ??DATE Text "05-17-90"
- ??FILENAME Text "FDREAD "
- ??TIME Text "18:51:34"
- ??VERSION Number 0100
- @CPU Text 0101H
- @CURSEG Text CSEG #2
- @FILENAME Text FDREAD
- @WORDSIZE Text 2 #2
- ACTIVE Byte CSEG:001D #21 26 70 172 173
- ALRDYIN Near CSEG:01B1 207 #218
- EN Far CSEG:001E #23 139 261
- ENTR Word CSEG:0008 #9 142
- ENTRY Far CSEG:007E 9 #87
- ERROR Far CSEG:0012 #13 141 142
- EXEINST Near CSEG:0159 #168 269
- EXGEM Near CSEG:009E 107 #109
- EXIT Near CSEG:0053 27 29 31 33 #48 67 169
- EXIT1 Near CSEG:0096 #106 143
- FDOFFMSG Byte CSEG:0149 #161 233
- FDONMSG Byte CSEG:013A #158 230
- FDSET Near CSEG:01D4 223 227 #237
- INIT Near CSEG:00AC 102 #127
- INWEGO Near CSEG:01E2 211 #246
- MODE Text 1 10 48 49 145 169
- NIMSG Byte CSEG:011D #153 212
- NOCHNG Near CSEG:0050 43 #45
- NOO Near CSEG:0191 199 #201
- OFSACT Near CSEG:0060 #70 172
- OLD13 Dword CSEG:0019 #18 48 172 173 250 251 261 265
- OLD13_OFS Word CSEG:0019 #19 136
- OLD13_SEG Word CSEG:001B #20 137
- PUMPITOUT Near CSEG:01CF 232 #234
- ROUT Far CSEG:0096 #105
- SAVREQ Dword CSEG:006F #77 98 130 251 265
- SAVREQ_O Word CSEG:006F #78 82
- SAVREQ_S Word CSEG:0071 #79 83
- SHOWHAT Near CSEG:01C4 225 #229
- SPCL Near CSEG:0058 25 #66
- STRA Word CSEG:0006 #8 141
- STRATEGY Far CSEG:0073 8 #81
- TEXT Byte CSEG:00EA 127 #145 246
- TRYF Near CSEG:01BC 221 #224
- TSTACT Near CSEG:0023 #26 173
- UNKWN_COM Near CSEG:009B 101 #108
-
- Groups & Segments Bit Size Align Combine Class Cref defined at #
-
- CSEG 16 0219 Word Public + #2 3 88
- DEVICE_DVR
-
-